import rclpy
import threading
import requests


class ThreadPython:

    def __init__(self,url:str):
        self.url=url
        pass

    def start_download(self,callback) :
        thread=threading.Thread(target=self.download,args=callback)
        thread.start()

    def download(self,callback) :
        res=requests.get(self.url)
        res.encoding='utf-8'
        callback(self.url,res.text)

def word_count(url,result) :

    print (f"{url}:{len(result)}->{result[:5]}")
    



def main():
    download=ThreadPython("")

    download.download(word_count)
    download.start_download(word_count)



